package com.deer.im.config;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.util.WebAppRootListener;

/**
 * 消息服务启动配置类
 * @author deer
 * @date 2021年11月30日
 */
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class DeerImContextConfig implements ServletContextInitializer {

	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
		/**
		 * 添加websocket发送长度
		 */
		servletContext.addListener(WebAppRootListener.class);
		servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize", "10240");
		servletContext.setInitParameter("org.apache.tomcat.websocket.binaryBufferSize", "10240000");
	}

}
